﻿@model ProjectManagement.Models._Task
@using Projectmanagement.Utl
@using Projectmanagement.Entity
<fieldset style="width: 700px;">
    <legend id="legendTitle">新建下属任务</legend>
    <table class="noline">
        <tr>
            <td>@Html.LabelFor(x => x.Name)
            </td>
            <td>
                @Html.TextBoxFor(x => x.Name, new { style = "width:165px;" })
                @Html.HiddenFor(x => x.ID)<br />
                @Html.ValidationMessageFor(x => x.Name)
            </td>
            <td>@Html.LabelFor(x => x.ProjectID)
            </td>
            <td>
                @Html.DropDownListFor(x => x.ProjectID, Model.GetProjectSelectListItems(), "请选择......", new { style = "width:165px;" })<br />
                @Html.ValidationMessageFor(x => x.ProjectID)
            </td>
        </tr>
        <tr>
            <td>@Html.LabelFor(x => x.StartDate)
            </td>
            <td>
                @Html.Telerik().DatePickerFor(x => x.StartDate).HtmlAttributes(new { style = "width: 185px" })<br />
                @Html.ValidationMessageFor(x => x.StartDate)
            </td>
            <td>@Html.LabelFor(x => x.MilestoneID)
            </td>
            <td>
                @Html.DropDownListFor(x => x.MilestoneID, new List<SelectListItem>(), "请选择......", new { style = "width:165px;" })
                <br />
                @Html.ValidationMessageFor(x => x.MilestoneID)
            </td>
        </tr>
        <tr>
            <td>@Html.LabelFor(x => x.EndDate)
            </td>
            <td>
                @Html.Telerik().DatePickerFor(x => x.EndDate).HtmlAttributes(new { style = "width: 185px" })<br />
                @Html.ValidationMessageFor(x => x.EndDate)
            </td>
            <td>@Html.LabelFor(x => x.Owners)
            </td>
            <td>
                @Html.HiddenFor(x => x.Owners)<span class="oname">@Model.Owners</span>
                @Html.Partial("_PartialMemberSelect", "#ProjectID")<br />
                @Html.ValidationMessageFor(x => x.Owners)
            </td>
        </tr>
        <tr>
            <td>@Html.LabelFor(x => x.Sequence)
            </td>
            <td>
                @Html.Telerik().IntegerTextBoxFor(model => model.Sequence).InputHtmlAttributes(new { style = "width: 165px" })<br />
                @Html.ValidationMessageFor(x => x.Sequence)
            </td>
        </tr>
        <tr>
            <td>@Html.LabelFor(x => x.TaskStateID)
            </td>
            <td>
                @Html.DropDownListFor(x => x.TaskStateID, new SelectList(CH.GetAllDatas<TaskState>(), "ID", "Name"), "-请选择-", new { style = "width:165px;" })<br />
                @Html.ValidationMessageFor(x => x.KMLinks)
            </td>
        </tr>
        <tr>
            <td>@Html.LabelFor(x => x.FinishDate)
            </td>
            <td>
                @Html.Telerik().DatePickerFor(x => x.FinishDate).HtmlAttributes(new { style = "width: 185px" })<br />
                @Html.ValidationMessageFor(x => x.FinishDate)
            </td>
        </tr>
        <tr>
            <td>@Html.LabelFor(x => x.Content)
            </td>
            <td colspan="3">
                @Html.TextAreaFor(x => x.Content, new { rows = "4", cols = "62" })<br />
                @Html.ValidationMessageFor(x => x.Content)
            </td>
        </tr>
        <tr>
            <td>@Html.LabelFor(x => x.KMLinks)
            </td>
            <td colspan="3">
                @Html.TextAreaFor(x => x.KMLinks, new { rows = "4", cols = "62" })<br />
                @Html.ValidationMessageFor(x => x.KMLinks)
            </td>
        </tr>
        <tr>
            <td>@Html.LabelFor(x => x.Deliverables)
            </td>
            <td colspan="3">
                @Html.TextAreaFor(x => x.Deliverables, new { rows = "4", cols = "62" })<br />
                @Html.ValidationMessageFor(x => x.Deliverables)
            </td>
        </tr>
    </table>
</fieldset>
<script type="text/javascript">
    $(function () {
        flashMilestone();
    });

    $("#ProjectID").change(function () {
        flashMilestone();
    })

    function flashMilestone() {
        var ProjectID = $("#ProjectID").val();
        if (ProjectID != null) {
            $.post("/Task/MilestoneFilter", { ProjectID: ProjectID }, function (result) {
                $("#MilestoneID").empty();
                $("#MilestoneID").append("<option value=''>请选择......</option>");

                if (result != null) {
                    for (var i = 0; i < result.length; i++) {
                        $("#MilestoneID").append("<option value='" + result[i].value + "'>" + result[i].text + "</option>");
                    }
                }
            })
        }
    }

</script>
<style>
    .noline
    {
        width: 100%;
    }
    .noline, .noline tr, .noline td
    {
        border: 0;
        padding: 2px;
    }
</style>
